package org.example.v4.action;

import org.example.v4.enums.Event;
import org.example.v4.OrderStateFactory;
import org.example.v4.OrderStateMachine;
import org.example.v4.enums.OrderState;

/**
 * PaidStateAction 类表示订单的已支付状态。
 */
public class PaidStateAction extends AbstractOrderStateAction {
    @Override
    protected void handleInternal(OrderStateMachine context, Event event) {
        System.out.println("支付成功。");
    }

    @Override
    protected boolean isValidEvent(Event event) {
        return event == Event.SHIP;
    }

    @Override
    protected void nextState(OrderStateMachine context) {
        context.setStateAction(OrderStateFactory.getState(OrderState.SHIPPED));
    }
}